﻿<div class="row" ng-controller="WalletController" style="height:209px">
    <div class="col-lg-21 col-sm-12 col-xs-12">
            <div class="well with-header" style="padding:20px">
                <div class="header bg-themeprimary">
                    Wallet Manage
                    <div class="btn-group pull-right">
                        <!--<span class="btn btn-sm" ng-click="popup('','FormAddModal','WalletAddModalInstanceCtrl','sm')"><i class="fa fa-plus-circle"></i> Add</span>-->
                        <span class="btn btn-sm" ng-click="popup('','FormCashOutModal','WalletCashoutModalInstanceCtrl','sm')" ng-if="true"><i class="fa fa-plus-circle"></i> Cashout</span>
                    </div>
                </div>
            </div>
            <div class="body">
                <p class="text-success">{{PaymentMesseger}}</p>
                <tabset justified="true">
                    <div class="col-lg-3 col-md-6" ng-repeat="item in WalletList">
                        <div class="col-lg-3 col-md-6" style="width:100%">
                            <div class="panel panel-primary" style="border:thin solid #ccc;box-shadow:2px 2px 2px #888">
                                <div class="panel-heading" style="background:#fff">
                                    <div class="row" style="height:65px">
                                        <div style="width:100%;height:65px">
                                            <div class="glyphicon glyphicon-usd" style="width:100%;height:41px;margin:auto;color:#50a8e1;font-size:40px;margin-top:10px;text-align:center"></div>
                                            <div style="width:70%;height:35px;background-color:#50a8e1;position:absolute;top:70px;left:15%;text-align:center;font-size:20px;padding-top:5px">
                                                <!--<span class="databox-number orange" style="color:#fff !important"><i class="glyphicon glyphicon-bitcoin"></i> {{item.Balance|number}}</span>-->
                                                <span class="databox-number orange" style="color:#fff !important"><i class="glyphicon glyphicon-bitcoin"></i> {{item.Balance}}</span>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="panel-footer">
                                    <div class="row" style="height:90px">
                                        <p style="width:80%;height:40px;margin:auto;margin-top:30px;text-align:center"><a href="#/app/wallethistory/{{item.Id}}">{{item.Name}}</a></p>
                                        <div class="clearfix"></div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </tabset>
            </div>
    </div>
    <!--Success Modal Templates-->
    <script type="text/ng-template" id="WarningModal">
        <div class="modal-header">
            <i class="glyphicon glyphicon-check"></i>
        </div>
        <div class="modal-title">{{title}}</div>
        <div class="modal-body">
            {{ messeger }}
        </div>
        <div class="modal-footer">
            <button type="button" class="btn btn-success" ng-click="ok()">OK</button>
            <button type="button" class="btn btn-default" ng-click="cancel()">Cancel</button>
        </div>
    </script>
    <script type="text/ng-template" id="FormAddModal">
        <div class="modal-header">
            <strong>Add</strong>
        </div>
        <div class="modal-body">
            <p class="text-danger">{{messeger}}</p>
            <div class="loginbox">
                <form name="simpleForm" method="post" class="bv-form" novalidate="novalidate">
                    <div class="form-group">
                        <label>Payment</label>
                        <ui-select ng-model="payment.selected">
                            <ui-select-match placeholder="Select or search a payment in the list...">
                                {{$select.selected.Name}}
                            </ui-select-match>
                            <ui-select-choices repeat="item in PaymentMethod | filter: $select.search">
                                <span ng-bind="item.Name"></span>
                            </ui-select-choices>
                        </ui-select>
                        {{data.PaymentId=payment.selected.Id;""}}
                    </div>
                    <div class="form-group">
                        <label>Amount (฿)</label>
                        <input class="form-control" ng-model="data.Amount" placeholder="Amount" type="text">
                    </div>
                </form>
            </div>

        </div>
        <div class="modal-footer">
            <span ng-if="processing" class="text-success"><i class="fa fa-circle-o-notch fa-spin"></i></span>
            <button type="button" class="btn btn-success" ng-click="doAddPack(data)">Add Pack</button>
            <button type="button" class="btn btn-default" ng-click="cancel()">Cancel</button>
        </div>
    </script>
    <script type="text/ng-template" id="FormCashOutModal">
        <div class="modal-header">
            <strong>CashOut</strong>
        </div>
        <div class="modal-body">
            <div class="loginbox">
                <p class="text-danger">{{messeger}}</p>
                <form name="simpleForm" method="post" class="bv-form" novalidate="novalidate">
                    <div class="form-group">
                        <label>Payment Method</label>
                        <ui-select ng-model="payment.selected">
                            <ui-select-match placeholder="Select or search a payment in the list...">
                                {{$select.selected.Name}}
                            </ui-select-match>
                            <ui-select-choices repeat="item in PaymentMethod | filter: $select.search">
                                <span ng-bind="item.Name"></span>
                            </ui-select-choices>
                        </ui-select>
                        {{data.PaymentId=payment.selected.Id;""}}
                    </div>
                    <div class="form-group">
                        <label>Amount (฿)</label>
                        <input class="form-control" ng-model="data.Amount" type="text" ng-pattern="/^[0-9.]+$/" ng-change="doProcess(data)">
                    </div>
                    <!--<div class="form-group">
                        <label>Fee {{data.Fee}}%</label>
                        <input class="form-control" ng-model="data.Fee" placeholder="Fee" type="text" readonly>
                    </div>
                    <!--<div class="form-group">
                        <label>After Fee</label>
                        <input class="form-control" ng-model="data.After" placeholder="Amount" type="text" readonly>
                    </div>-->
                    <!--<div class="form-group">
                        <label>
                            <i class="fa fa-usd"></i> {{usdValue}} <span ng-bind="total"></span> | 1 <i class="fa fa-bitcoin"></i> = <i class="fa fa-usd"></i> {{rate}}
                        </label>
                    </div>-->
                    <div class="form-group">
                        <label>Chose Wallet</label>
                        <ui-select ng-model="wallet.selected">
                            <ui-select-match placeholder="Select or search a wallet in the list...">
                                {{$select.selected.Name}}
                            </ui-select-match>
                            <ui-select-choices repeat="item in WalletList | filter: $select.search">
                                <span ng-bind="item.Name"></span>
                            </ui-select-choices>
                        </ui-select>
                        {{data.Wallet=wallet.selected.Id;""}}
                    </div>
                    <div class="form-group">
                        <label>Pin Code</label>
                        <input class="form-control" ng-model="data.PinCode" type="text">
                    </div>
                </form>
            </div>
        </div>
        <div class="modal-footer">
            <span ng-if="processing" class="text-success"><i class="fa fa-circle-o-notch fa-spin"></i></span>
            <button type="button" class="btn btn-success" ng-click="doCashout(data)" ng-disabled="processing">Cash Out</button>
            <button type="button" class="btn btn-default" ng-click="cancel()">Cancel</button>
        </div>
    </script>
    <!--End Success Modal Templates-->
</div>
